<?php

namespace App\ZhCN\Api;

if (!defined('IN_PX'))
    exit;


use App\Service;
use Phoenix\Http\RequestMethod;
use Phoenix\Support\MsgHelper;
use App\Tools\Auxi;
use App\Tools\Html;
use Phoenix\Log\Log4p as logger;

class Member {

    private function __RestController() {
    }

    private function __Route($value = '/api/member') {
    }

    private function __Value($__PACKAGE__, $__ROOT__, $__RM__, $setting, $cfg, $__LANGUAGE_ID__) {}

    protected function __Inject($session, $db, $cache, Service\Member $serMem, Service\Collection $serColl, Service\Comment $serCom) {}

    /**
     * @Title: login
     * @Description: TODO 用户登录
     * @return array
     * @author WangSHuo
     * @date
     */
    public function login($__Method = RequestMethod::POST) {
        $_return = $this->serMem->memberLogin($_POST);
        return $_return;
    }

    /**
     * @Title: register
     * @Description: TODO 注册会员
     * @return array
     * @author WangSHuo
     * @date
     */
    public function register($__Method = RequestMethod::POST) {
        $_return = $this->serMem->register($_POST);
        return $_return;
    }

    /**
     * @Title: loginOut
     * @param string $__Method
     * @Description: TODO 退出登录
     * @return mixed
     * @author TUGE
     * @date
     */
    public function loginOut() {
        $this->session->destory('user');
        if (!$this->session->user) {
            return MsgHelper::err(0);
        } else {
            return MsgHelper::err(20000, '退出失败');
        }
    }

    /**
     * @Title: register
     * @Description: TODO 授权登录绑定会员
     * @return array
     * @author WangSHuo
     * @date
     */
    public function addOpenid($__Method = RequestMethod::POST) {
        $_return = $this->serMem->addOpenid($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: perfect
     * @Description: TODO 完善个人资料
     * @return array
     * @author WangSHuo
     * @date
     */
    public function perfect() {
        $_return = $this->serMem->perfect($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: modifyPassword
     * @Description: TODO 修改密码
     * @return array
     * @author WangSHuo
     * @date
     */
    public function modifyPassword($__Method = RequestMethod::POST) {
        $_return = $this->serMem->modifyPassword($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: uploadPassword
     * @Description: TODO 忘记密码
     * @return array
     * @author WangSHuo
     * @date
     */
    public function uploadPassword($__Method = RequestMethod::POST) {
        $_return = $this->serMem->uploadPassword($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: sendMobileCode
     * @Description: TODO 发送手机验证码
     * @return array
     * @author TUGE
     * @date
     */
    public function sendMobileCode($__Method = RequestMethod::POST) {
        $_return = $this->serCom->sendMobileCode($_POST);
        return $this->serCom->returnErr($_return);
    }


    /**
     * @Title: ckValidCode
     * @Description: TODO  分配用户优惠券时的短信通知
     * @return array
     * @author TUGE
     * @date
     */
    public function ckValidCode($__Method = RequestMethod::POST) {
        $_return = $this->serCom->ckValidCode($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: collection
     * @Description: TODO  添加修改收藏
     * @return array
     * @author TUGE
     * @date
     */
    public function collection($__Method = RequestMethod::POST) {
        $_return = $this->serColl->collection($_POST);
        return $this->serCom->returnErr($_return);
    }

    /**
     * @Title: collection
     * @Description: TODO  批量删除收藏
     * @return array
     * @author TUGE
     * @date
     */
    public function deleteCollection($__Method = RequestMethod::POST) {
        $_return = $this->serColl->deleteCollection($_POST);
        return $this->serCom->returnErr($_return);
    }
}
